#include <iostream>
#include <array>
#include <algorithm>

using namespace std;

int main() {
    unsigned ans = 0;
    for (unsigned x1 = 0; x1 <= 50; ++x1) {
        for (unsigned y1 = 0; y1 <= 50; ++y1) {
            if (x1 == 0 && y1 == 0)
                continue;
            for (unsigned x2 = 0; x2 <= 50; ++x2) {
                for (unsigned y2 = 0; y2 <= 50; ++y2) {
                    if (x2 == 0 && y2 == 0)
                        continue;
                    if (x2 == x1 && y2 == y1)
                        continue;
                    array<uint64_t, 3> arr {
                        x1 * x1 + y1 * y1,
                        x2 * x2 + y2 * y2,
                        (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1),
                    };
                    sort(arr.begin(), arr.end());
                    if (arr[0] + arr[1] == arr[2])
                        ++ans;
                }
            }
        }
    }
    cout << ans / 2 << endl;
}